package com.manatee.adnet;

import com.example.commercailapp.R;

import android.app.Activity;
import android.content.Context;
import android.graphics.PixelFormat;
import android.view.Gravity;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import android.view.View;

public class ViewHelper {
	private Activity activity;
	public ViewHelper(Activity act) {
		activity = act;
	} 
	
	public void displayTextView (String jsonCommercials) {
		TextView txt_debug = (TextView)activity.findViewById(R.id.debugText);
		txt_debug.setText(jsonCommercials);
	}
	
	public void diplayWindowView (String jsonCommercials) {
		//ImageView iv = (ImageView) activity.findViewById(R.id.image);
		//TODO not able add window
		WindowManager wm = (WindowManager)activity.getSystemService(Context.WINDOW_SERVICE);
		
		WindowManager.LayoutParams p = new WindowManager.LayoutParams(
			    // Shrink the window to wrap the content rather than filling the screen 
			    WindowManager.LayoutParams.WRAP_CONTENT,
			    WindowManager.LayoutParams.WRAP_CONTENT,
			    // Display it on top of other application windows, but only for the current user
			    WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
			    // Don't let it grab the input focus
			    WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
			    // Make the underlying application window visible through any transparent parts
			    PixelFormat.TRANSLUCENT);

			// Define the position of the window within the screen
			p.gravity = Gravity.TOP | Gravity.RIGHT;
			p.x = 0;
			p.y = 100;
		//wm.addView (iv, p);

	}

}
